import jsonp from '@/assets/js/jsonp.js'





export default function getToplistsData(){
	const url="https://c.y.qq.com/v8/fcg-bin/fcg_myqq_toplist.fcg"

	let data={
		format: "jsonp",
		inCharset: "utf-8",
		outCharset: "utf-8",
		notice: 0,
		platform: "h5",
		needNewCode: 1,
	}
	return jsonp(url,data,{param:"jsonpCallback"});
}


export function getToplist(id){
	const url="https://c.y.qq.com/v8/fcg-bin/fcg_v8_toplist_cp.fcg"

	let data={
		uin: 0,
		format: 'jsonp',
		inCharset: 'utf-8',
		outCharset: 'utf-8',
		notice: 0,
		platform: 'h5',
		needNewCode: 1,
		tpl: 3,
		page: 'detail',
		type: 'top',
		topid: id,
	}
	return jsonp(url,data,{param:"jsonpCallback"});
}
// export class Song{
// 	constructor({id, mid, singername, songname, albumname, duration, img, url}){
// 		this.id = id
// 		this.mid = mid
// 		this.singername = singername
// 		this.songname = songname
// 		this.albumname = albumname
// 		this.duration = duration
// 		this.img = img
// 		this.url = url
// 	}
// }

// export function createSong(musicData) {
//   return new Song({
//     id: musicData.songid,
//     mid: musicData.songmid,
//     singername: filterSinger(musicData.singer),
//     songname: musicData.songname,
//     albumname: musicData.albumname,
//     duration: musicData.interval,
//     img: `https://y.gtimg.cn/music/photo_new/T003R300x300M000${musicData.albummid}.jpg?max_age=2592000`,
//     url: `http://ws.stream.qqmusic.qq.com/C100${musicData.songmid}.m4a?fromtag=0&guid=126548448`
//   })
// }

// function filterSinger(singer) {
//   let ret = []
//   if (!singer) {
//     return ''
//   }
//   singer.forEach((s) => {
//     ret.push(s.name)
//   })
//   return ret.join('/')
// }

